import request from '@/utils/request.js'

export const loginByPassword = (account, password) => {
  return request({
    method: 'POST',
    url: '/login',
    data: {
      account,
      password,
    }
  })
}

export const loginByCaptcha = (phone, captcha) => {
  return request({
    method: 'POST',
    url: '/login',
    data: {
      phone,
      captcha,
    }
  })
}

/**
 * 获取用户验证码
 */
export const getVerifyCode = () => {
  return request({
    method: 'GET',
    url: '/verify_code',
  })
}

/**
 * 获取短信验证码
 */
export const getMessageCode = (key, phone) => {
  return request({
    method: 'POST',
    url: '/register/verify',
    data: {
      key,
      phone,
      type: 'login',
    }
  })
}
